import Vue from 'vue'
import Router from 'vue-router'
import main from './modules/main' //首页
import welcome from './modules/welcome' //欢迎页
import shopBusiness from './modules/shopBusiness'



Vue.use(Router)

/**
 * hidden: true                   为true时不会在侧边栏展示，默认值为false
 * alwaysShow: true               设置为true，会一直在根菜单展示，不管是否有子路由
 * redirect: noredirect           在面包屑中将不会重定向
 * name:'router-name'             <keep-alive>中使用，请设置
 * meta : {
    title: 'title'               左侧菜单和面包屑中展示
    icon: 'svg-name'             左侧菜单中展示
  }
 **/
export const asynRouterMap = [
  welcome,
  main,
  shopBusiness,
  //登录
  { path: '/login', name: 'login', component: () => import('@/views/login/index') },
  //404页面
  { path: '/404', name: 'notFound', component: () => import('@/views/404') }
]
export const constantRouterMap = [
  //登录
  { path: '/login', name: 'login', component: () => import('@/views/login/index') },
  //404页面
  { path: '/404', name: 'notFound', component: () => import('@/views/404') }
]
export default new Router({
  mode: 'history', // 后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: asynRouterMap
  // routes: constantRouterMap
})
